<template>
  <div
    class="progress-parent"
    v-show="store.progressVisible && !store.exhibitsInfoShow && !store.childRemarksShow"
    :class="{
      'progress-parent-wap': store.isMobileType,
    }"
  >
    <div
    @click="expandItem(item.id, index)"
      class="items"
      :class="{ 'items-active': index === store.previewModuleIndex }"
      v-for="(item, index) in store.templateMOdeList"
      :key="item.id"
    >
      <div class="node-shadow">
        <div class="shadow">
          <img v-if="item.value" class="shadow-img" :src="urls + item.value + '?imageView2/3/format/webp'" alt="" />
          <nullImage v-else />
          <div class="title-box">
            <span>{{ item.text }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import nullImage from '@/components/imageNull/index.vue';
import { publicUrls } from '@/utils/minxin';
import { urls } from '@/utils/request/upload';
import { psthOutline } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { useRoute } from 'vue-router';
import { ref, onMounted, onBeforeUnmount, watch, computed } from 'vue';
import { cloneDeep } from 'lodash';
const store = useProjectStore();
const route = useRoute();
const props = defineProps({
  scrollDom: {
    type: Object,
  },
  scrollLeftNum: {
    type: Number,
  },
});
const nodesList = ref([]);
const emit = defineEmits(['emitScroll']);
const progress = ref(0);

const expandItem = (id: number, index: number) => {
  if (store.previewModuleIndex === index) {
    {
      return;
    }
  }
  store.previewModuleIndex = index;
  setTimeout(() => {
    psthOutline('Level1outline' + id);
  }, 100);
};


onMounted(() => {
  // 可以在这里添加一些初始化逻辑
});


</script> 

<style scoped lang="less">
.progress-parent {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: 40px;
  left: 64px;
  width: calc(100% - 128px);
  height: 10px;
  z-index: 999;
  transform: scaleZ(1px);
}
.progress-parent-wap {
  height: 20px;
}
.items {
  position: relative;
  display: flex;
  flex: 1;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.3);
  margin: 0 2px;
  border-radius: 4px;
}
.items-active {
  background: #e62b17;
}
.node-shadow {
  position: absolute;
  top: -156px;
  left: calc(50% - 108px);

  width: 216px;
  height: 144px;
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  display: none;
}
.shadow {
  position: relative;
  display: flex;
  width: 216px;
  height: 144px;
  border-radius: 10px;
  overflow: hidden;
}
.shadow-img {
  width: 216px;
  height: 144px;
  object-fit: cover;
  border-radius: 10px;
}
.title-box {
  display: flex;
  position: absolute;
  padding: 8px 12px;
  padding-top: 18px;
  bottom: 0;
  left: 0;
  width: 216px;
  height: 50px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, #000000 100%);
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.3);
  border-radius: 0px 0px 8px 8px;
  z-index: 66;
  span {
    width: 192px;
    height: 24px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    font-size: 16px;
    color: #ffffff;
    line-height: 24px;
    // text-shadow: 0px 0px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
.items:hover {
  .node-shadow {
    display: flex;
  }
}
</style>